public class Test {
    public int evalRPN(String[] tokens) {
        Stack<Integer> stack = new Stack<>();

        for(int i = 0;i < tokens.length;i++) {
            String ch = tokens[i];

            if(!isfull(ch)) {
                stack.push(Integer.valueOf(ch));
            }else {
                int r = stack.pop();
                int l = stack.pop();
                switch(ch) {
                    case "+":
                        stack.push(l + r);
                        break;

                    case "-":
                        stack.push(l - r);
                        break;

                    case "*":
                        stack.push(l * r);
                        break;

                    case "/":
                        stack.push(l / r);
                        break;
                }
            }
        }
        return stack.pop();
    }

    public boolean isfull(String ch) {
        if(ch.equals("+") || ch.equals("/") || ch.equals("*") || ch.equals("-")) {
            return true;
        }
        return false;
    }
    public int evalRPN(String[] tokens) {
        Stack<Integer> stack = new Stack<>();

        for(int i = 0;i < tokens.length;i++) {
            String ch = tokens[i];

            if(!isfull(ch)) {
                stack.push(Integer.valueOf(ch));
            }else {
                int r = stack.pop();
                int l = stack.pop();
                switch(ch) {
                    case "+":
                        stack.push(l + r);
                        break;

                    case "-":
                        stack.push(l - r);
                        break;

                    case "*":
                        stack.push(l * r);
                        break;

                    case "/":
                        stack.push(l / r);
                        break;
                }
            }
        }
        return stack.pop();
    }

    public boolean isfull(String ch) {
        if(ch.equals("+") || ch.equals("/") || ch.equals("*") || ch.equals("-")) {
            return true;
        }
        return false;
    }
}
